package com.kdzy.lshy.common.controller;

import com.kdzy.lshy.common.service.IDCardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;


/**
 * @author hanrui
 * @since  2018-06-15
 * @apiNote 身份证信息读取方法
 */

@RestController
@CrossOrigin("*")
@RequestMapping(value = "/faced")
@Api(value = "IDCardController")

public class IDCardController {

    @Autowired
    private IDCardService idCardService;

    /**
     * 获取身份证信息
     *
     * 参数: path 身份证图片URL
     *
     * @return
     */

    @RequestMapping("/idcard/path/info")
    @ApiOperation(notes = "/idcard/path/info", httpMethod = "POST", value = "获取身份证信息")
    public Object getIDcardInfoByPath(

            @ApiParam(
                    required = true,
                    value = "path",
                    name = "path"
            )
                    String path, HttpServletRequest request){


        return  idCardService.getIDcardInfoByPath(path,request);
    }



    /**
     * 获取身份证信息
     *
     * 参数: file
     * 类型  Base64的String
     *
     * @return
     */

    @RequestMapping(value = "/idcard/base64/info",method = RequestMethod.POST)
    @ApiOperation(notes = "/idcard/base64/info", httpMethod = "POST", value = "获取身份证信息")
    public Object getIDcardInfoByBase64String(

            @ApiParam(
                    required = true,
                    value = "base64String",
                    name = "base64String"
            )
                    String base64String, HttpServletRequest request){


        return  idCardService.getIDcardInfoByBase64String(base64String,request);
    }



}
